﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Configuration;

namespace Web_HengliSeed
{
    /// <summary>
    /// Product 的摘要说明
    /// </summary>
    public class Product : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string result = "";
            string title = context.Server.UrlDecode(context.Request["title"]);
            string name = context.Server.UrlDecode(context.Request["name"]);
            string phone = context.Server.UrlDecode(context.Request["phone"]);
            string email = context.Server.UrlDecode(context.Request["email"]);
            if (!string.IsNullOrEmpty(ConfigurationManager.AppSettings["ReceiveEmail"]))
            {
                string content = string.Format("用户[{0}]对产品:{1}感觉兴趣，他的电话:{2},邮箱:{3}", name, title, phone, email);
                Web_HengliSeed.ClassFile.Function.SendMail(ConfigurationManager.AppSettings["ReceiveEmail"], content, "有人对您的产品感兴趣啦");
                result = "ok";
            }
            context.Response.Write(result);
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}